/**
Copyright (c) 2008 Arnaud Fabre <arnaud333@gmail.com>
Copyright (c) 2008 Pierre "delroth" Bourdon <root@delroth.is-a-geek.org>

This file is part of Vos Tutos Offline.

Vos Tutos Offline is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Vos Tutos Offline is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Vos Tutos Offline.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _VTO_TREEVIEW_H
#define _VTO_TREEVIEW_H

#include <QTreeWidget>
#include <QString>

#include "global.h"
#include "doc_part.h"
#include "doc_minitutorial.h"
#include "doc_bigtutorial.h"

class ICTreeItem : public QTreeWidgetItem
{
public: 
	ICTreeItem(IntroducedDocument* docp, int type);
	ICTreeItem(const QStringList& list, IntroducedDocument* docp, int type);
	
	IntroducedDocument* getParent() const;
	int getType() const;
	
	void setParent(IntroducedDocument* p);
	void setType(int type);
	
protected:
	IntroducedDocument* parent;
	int type;
};

class TutoTreeItem : public QTreeWidgetItem
{
public:
    TutoTreeItem(TitledDocument* docp, int type);
    TutoTreeItem(const QStringList& list, TitledDocument* docp, int type);
    
    TitledDocument* getPart() const;
    int getType() const;

    void setPart(TitledDocument* p);
    void setType(int type);

protected:
    TitledDocument* part;
    int type;
};

class TutoTree : public QTreeWidget
{
    Q_OBJECT

public:
    TutoTree(TitledDocument* doc, int type, QWidget* parent = 0);

    enum { BIGTUTORIAL=0, CHAPTER, MINITUTORIAL, NEWS, INTRO, CONCLU};
    
    int getType() const;
    void setType(int type);

    void refresh();

protected:
    TutoTreeItem* getClearedRoot(int type);

    void refreshPart();
    void refreshMiniTutorial();
    void refreshBigTutorial();

    int type;
    TitledDocument* doc;
};

#endif

